<template>
    <div>
        <h2> TsSubmit </h2>
        {{ phone }}
        <hr>
        {{ count }}
        <hr>
        {{ username }}
        <hr>
        {{ hobbys }}
        <hr>
        {{ info }}
        <hr>
        {{ cb }}
        <hr>
        {{ isAdmin }}
        <hr>
        <button>TsSubmit</button>
    </div>
</template>
<script>
export default {
    // props:['count'],
    props: {
        // count: [Number, String],
        count: {
            type: [Number, String],
            required: true,//必填
        },
        // username: String,
        username: {
            type: String,
            // default: 'lili'
            default() {
                return 'lili'
            }
        },
        // isAdmin: Boolean,
        isAdmin: {
            type: undefined,// undefined null 不限制数据类型
        },
        info: Object,
        hobbys: Array,
        cb: Function,
        phone: {
            type: String,
            validator: (value) => {
                // value 传入的参数值
                // return true // 通过
                // return false // 失败
                return /^(?:(?:\+|00)86)?1\d{10}$/.test(value);
            }
        },
        email: {
            type: String,
            validator: (value) => {
                return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(value);
            }
        },
        gender: {
            type: String,
            validator: (value) => {
                return ['girl', 'boy'].includes(value);
            }
        }
    }
}
</script>